home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / clonecd / September 93.img / Archives / Applications / Graphics / image / Pico 2.0 / Adding Effects next >
Text File  |  1991-08-27  |  1KB  |  25 lines

  1. If you want to add operations to Pico that can't be expressed with the language, you can write code in Think C and paste it into the application as a code resource.
  2.  
  3. Use Think C to create a code resource of type 'EFCT'.  The "main" for this code resource should look like this:
  4.  
  5.         #include <SetUpA4.h>        /* Required to access any globals */
  6.  
  7.         void main( unsigned char ** Old, unsigned char ** New )
  8.         {
  9.                RememberA0();    /* Required if any globals are used (e.g. random */
  10.                SetUpA4();          /* number seeds).  See the Think C manual. */
  11.  
  12.                 /* Your code here ... */
  13.  
  14.                RestoreA4();
  15.   }
  16.  
  17. Where "Old" and "New" are 256x256 pixel arrays, indexed like this:
  18.  
  19.         Old[y][x]
  20.  
  21. with 0 ≤ x < 256, 0 ≤ y < 256.  The pixel values range from 0 (black) to 255 (white).  Your code should take the pixels in Old, process it, and place the results in New.  Examples of source code for effects can be found in Chapter 6 of Holzmann's book.
  22.  
  23. Name the code resource with your effect, and paste it into the Pico application (be sure to use a resource ID number that doesn't conflict with the effects already there).  When you run Pico, your effect's name should appear in the Effects menu.
  24.  
  25.